package com.easy.dev.entity;

import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

@Data
public class Log {

    @TableId(type=IdType.AUTO)
    private Long id;
    @TableField("class_name")
    private String className;
    @TableField("method_name")
    private String methodName;
    @TableField("table_name")
    private String tableName;
    @TableField("user_id")
    private Long userId;
    @TableField("operate_time")
    private Long operateTime;
    @TableField("run_time")
    private Long runTime;
    @TableField("params")
    private String params;
    @TableField("`result`")
    private String result;
    @TableField("exception")
    private byte[] exception;
    @TableField("status")
    private Integer status;

    public Log(){}

    public Log(String className, String methodName, String tableName, Long userId, Long runTime, String params, String result, byte[] exception, Integer status) {
        this.className = className;
        this.methodName = methodName;
        this.tableName = tableName;
        this.userId = userId;
        this.operateTime = System.currentTimeMillis();
        this.runTime = runTime;
        this.params = params;
        this.result = result;
        this.exception = exception;
        this.status = status;
    }

    public Log(Long id, String className, String methodName, String tableName, Long userId, Long operateTime, Long runTime, String params, String result, byte[] exception, Integer status) {
        this.id = id;
        this.className = className;
        this.methodName = methodName;
        this.tableName = tableName;
        this.userId = userId;
        this.operateTime = operateTime;
        this.runTime = runTime;
        this.params = params;
        this.result = result;
        this.exception = exception;
        this.status = status;
    }
}